package scv.relatorio;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.HashMap;
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;


public class RelClientePorNomeSobrenome {
	Connection con;

	@SuppressWarnings("unchecked")
	public JasperPrint RelatorioProdutos(String nome) 
	throws Exception
	{ JasperPrint rel=null;

	String url = "jdbc:oracle:thin:@127.0.0.1:1521";
	try { 
		Class.forName("oracle.jdbc.OracleDriver");
	} catch(java.lang.ClassNotFoundException e1) { 
		System.err.print("ClassNotFoundException: "); 
		System.err.println(e1.getMessage()); 
	} 
	try { 
		con = DriverManager.getConnection(url,"SYSTEM", "123456"); 
	} catch(SQLException ex) { 
		System.err.print("SQLException: "); 
		System.err.println(ex.getMessage()); 

	}

	try	{ // Connection con = Conexao.criaConexao(); 
		HashMap map= new HashMap();

		map.put("name",nome.toUpperCase());

		String arquivoJasper= "C:\\workspace\\SCV\\relatorios\\RelatorioClienteNomeSobrenome.jasper"; 
		rel=JasperFillManager.fillReport(arquivoJasper,map,con);
		con.close();
	}
	catch (JRException e)
	{ e.printStackTrace(); 
	} 
	return rel; 
	}
}

